package com.meeting.meeting.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.meeting.meeting.dao.DepartmentMapper;
import com.meeting.meeting.model.Department;
import com.meeting.meeting.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 何星霖
 * @date 2019/12/28 20:37
 */
@Service
public class DepartmentServiceImpl implements DepartmentService {
    @Autowired
    DepartmentMapper departmentMapper;
    @Override
    public int deleteByPrimaryKey(Integer departmentid) {
        return departmentMapper.deleteByPrimaryKey(departmentid);
    }

    @Override
    public int insert(Department record) {
        return departmentMapper.insert(record);
    }

    @Override
    public Department selectByPrimaryKey(Integer departmentid) {
        return departmentMapper.selectByPrimaryKey(departmentid);
    }

    @Override
    public List<Department> selectAll() {
        return null;
    }

    @Override
    public PageInfo<Department> selectAll(Integer pageNum, Integer pageSize, Department record) {
        PageHelper.startPage(pageNum,pageSize);
        List<Department> list=departmentMapper.getAllDepartment(record);
        PageInfo<Department> pageInfo = new PageInfo<Department>(list);
        return pageInfo;
    }

    @Override
    public int updateByPrimaryKey(Department record) {
        return departmentMapper.updateByPrimaryKey(record);
    }
}
